home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_319
/
cnewssrc
/
cnews.orig.lzh
/
libc
/
efopen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-27
|
572b
|
32 lines
/*
* efopen - fopen file, exit with message if impossible
*/
#include <stdio.h>
/* imports from libc */
extern char *strcpy(), *strncat();
extern void error();
static char message[] = "can't open file \"%s\" mode ";
FILE *
efopen(file, mode)
char *file;
char *mode;
{
FILE *fp;
char fullmsg[sizeof(message)+10];
extern int errno;
errno = 0; /* Wipe out residue of earlier errors. */
fp = fopen(file, mode);
if (fp == NULL) {
(void) strcpy(fullmsg, message);
(void) strncat(fullmsg, mode, 10);
error(fullmsg, file);
/* NOTREACHED */
}
return(fp);
}